package cn.elwy.rcp.demo.nabula;

import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class NabulaDialog extends Dialog {

  protected Object result;
  protected Shell shell;

  /**
   * Create the dialog.
   * @param parent
   * @param style
   */
  public NabulaDialog(Shell parent, int style) {
    super(parent, style);
    setText("SWT Dialog");
  }

  /**
   * Open the dialog.
   * @return the result
   */
  public Object open() {
    createContents();
    shell.open();
    shell.layout();
    Display display = getParent().getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return result;
  }

  /**
   * Create contents of the dialog.
   */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setSize(450, 300);
    shell.setText(getText());
    
    NatTable natTable = new NatTable(shell);
    natTable.setBounds(50, 20, 313, 131);
    
    NatTable natTable_1 = new NatTable(shell);
    natTable_1.setBounds(33, 166, 81, 81);

  }
}
